package com.blb.day2;

import java.io.IOException;

public class SingletonTest {

    public static void main(String[] args) throws IOException {
//        Singleton1 s1 = Singleton1.getInstance();
//        Singleton1 s2 = Singleton1.getInstance();
//        System.out.println(s1 == s2);
//        Runtime.getRuntime().exec("mspaint");
        //创建100个线程，每个线程创建单例对象，测试饿汉式和懒汉式的区别
        for(int i = 0;i < 100;i++){
            new Thread(()->{
                Singleton5 instance = Singleton5.getInstance();
                System.out.println(instance.hashCode());
            }).start();
        }
    }
}
